package com.kakame.tibbers.service.auth;

import java.util.List;

import com.kakame.tibbers.common.models.FriendGroup;

public class FriendService {

	/**
	 * 查询用户的好友分组
	 * @auth ex-hejm
	 * @date 2018年12月3日 上午10:31:41
	 * @param id
	 */
	public List<FriendGroup> listGroupByUserId(Integer id) {
		StringBuilder sql = new StringBuilder();
		sql.append("select fg.*, fr.friend_id ");
		sql.append("  from t_friend_group fg ");
		sql.append("  left join t_friend_rel fr on fg.id = fr.group_id ");
		sql.append(" where fg.status != 'D' and fr.status != 'D' and fg.belong_id = ? ");
		sql.append(" order by fg.order_num asc ");
		return FriendGroup.dao.find(sql.toString(), id);
	}

}
